package com.controller;

import com.entity.PageBean;
import com.entity.PurOrder;
import com.entity.Result;
import com.group.PurOrderModifyGroup;
import com.service.PurInvoiceService;
import com.service.PurPayService;
import com.vo.PurOrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/purinvoice")
public class PurInvoiceController {
    @Autowired
    private PurInvoiceService purInvoiceService;

    @RequestMapping("/getInvoiceList/{pageIndex}/{pageSize}")
    public Result getInvoiceList(
          @PathVariable("pageIndex") Integer pageIndex,
          @PathVariable("pageSize") Integer pageSize,
          @RequestBody PurOrderVO purOrderVO
    ){
        PageBean<PurOrder> pageBean = purInvoiceService.getInvoiceList(pageIndex, pageSize, purOrderVO);
        return Result.ok(pageBean);
    }

    @PostMapping("/getPaystatusByoid/{oid}")
    public Result getPaystatusByoid(@RequestBody @PathVariable("oid") int oid){
        return Result.ok(purInvoiceService.getPaystatusByoid(oid));
    }

    @PostMapping("/modifyInvoiceList")
    public Result modifyInvoiceList( @RequestBody PurOrder purOrder){
        purInvoiceService.updateInvoiceList(purOrder);
        return Result.ok();
    }


}
